// 链接：https://ac.nowcoder.com/acm/problem/26229
// 来源：牛客网

// 第一行一个正整数n，代表音符的数量。    （1≤n≤200000）
// 第二行有n个正整数ai，代表每个音符的音高。（1≤ai≤100）
#include <iostream>
#include <set>
#include <climits>
using namespace std;

int pitch_high[200005];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> pitch_high[i];
    // multiset<int, std::less<int>> min_set; // 最小值集合
    // multiset<int> max_set;  //最大值的集合
    int pre = pitch_high[0];
    int ret = INT_MIN;
    int cur_long = 0;
    for (int i = 0; i < n; i++)
    {
        // cout << "-----------------------------" << endl;
        // cout << "当前插入值: " << pitch_high[i] << endl;
        if((pitch_high[i] - pre >= 9))
        {
            cur_long = 0;
        }
        pre = pitch_high[i];
        cur_long += 1;
        if (cur_long >= ret)
            ret = cur_long;
        // for (auto &x : min_set)
        //     cout << x << " ";
        //     cout << endl;
        // cout << "当前长度：" << cur_long << " " << "当前ret: " << ret << endl;
        // cout << "-----------------------------" << endl;
    }
    cout << ret;
    return 0;
}